<template>
  <a-modal
    :maskClosable="false"
    :destroyOnClose="true"
    :title="title"
    centered
    :width="400"
    v-model="visible"
    @ok="handleOk"
  >
    <div v-if="status === 1" class="content">确认款项已到账后操作</div>
    <a-textarea v-model="remark" :placeholder="placeholder" :rows="4" />
  </a-modal>
</template>

<script>
import { PayFeesReview, PaymenrecordReview } from '@/api/member/member'
export default {
  props: ['type'],
  data() {
    return {
      visible: false,
      isNotice: false,
      id: undefined,
      status: 1,
      title: '缴费通过',
      placeholder: '',
      remark: undefined
    }
  },
  methods: {
    show(data) {
      let { id, status, title, placeholder } = data
      this.id = id
      this.status = status
      this.title = title
      this.placeholder = placeholder
      this.remark = undefined
      this.visible = true
    },
    async handleOk() {
      let { id, status, remark } = this
      if (this.type === 1) {
        await PaymenrecordReview({ id, status, remark })
      } else {
        await PayFeesReview({ id, status, remark })
      }
      this.$message.success((status === 1 && '缴费通过') || '缴费驳回')
      this.visible = false
      this.$emit('success')
      if(this.type === 2){
        this.$router.replace({ path: '/member/approval' })
      }
    }
  }
}
</script>

<style scoped>
.content {
  padding-bottom: 20px;
}
</style>
